import { ConfigManager } from "../../../com/gengine/resource/ConfigManager";
import { TFightSpiritBreak } from "../../../Message/Db/Tables/TFightSpiritBreak";
import { TFightSpirit } from "../../../Message/Db/Tables/TFightSpirit";
type int = number;
//class FightSpiritConfig
    
    export  class FightSpiritConfig
    {
        constructor()
        {
            
            this._map = new Map<any, any> /* flash.utils.Dictionary */();
            this._mapBreak = new Map<any, any> /* flash.utils.Dictionary */();
            this.breakLvArr = [];
            if (FightSpiritConfig._instance != null) 
            {
                throw new Error(" FightSpiritConfig 单例 ");
            }
            this.init();
            return;
        }

        public init(): void
        {
            var loc1=ConfigManager.instance.getJSONByFileName("t_fight_spirit.json");
            this.writeUpdate(loc1);
            var loc2=ConfigManager.instance.getJSONByFileName("t_fight_spirit_break.json");
            this.writeBreak(loc2);
            return;
        }

        /* internal  */writeBreak(arg1: Object): void
        {
            var loc1=null;
            var loc2=null;
            var loc3=0;
            var loc4=arg1;
            for(loc2 of loc4) 
            {
                loc1 = new TFightSpiritBreak();
                loc1.level = loc2.level;
                loc1.materialNum = loc2.materialNum;
                loc1.money = loc2.money;
                loc1.percentAdd = loc2.percentAdd;
                loc1.successRate = loc2.successRate;
                this._mapBreak[loc1.level] = loc1;
                this.breakLvArr.push(loc1.level);
            }
            return;
        }

        public getFightSpiritBreakInfo(arg1: int): TFightSpiritBreak
        {
            return this._mapBreak[arg1];
        }

        /* internal  */writeUpdate(arg1: Object): void
        {
            var loc1=null;
            var loc2=null;
            var loc3=0;
            var loc4=arg1;
            for(loc2 of loc4) 
            {
                loc1 = new TFightSpirit();
                loc1.level = loc2.level;
                loc1.needExp = loc2.needExp;
                loc1.percentAdd = loc2.percentAdd;
                loc1.critProbability = loc2.critProbability;
                loc1.critMultiple = loc2.critMultiple;
                loc1.generalExp = loc2.generalExp;
                loc1.generalGhost = loc2.generalGhost;
                loc1.generalMoney = loc2.generalMoney;
                loc1.highExp = loc2.highExp;
                loc1.highGhost = loc2.highGhost;
                loc1.highMoney = loc2.highMoney;
                this._map[loc1.level] = loc1;
            }
            return;
        }

        public getFightSpiritInfo(arg1: int): TFightSpirit
        {
            return this._map[arg1];
        }

        public static get instance(): FightSpiritConfig
        {
            if (FightSpiritConfig._instance == null) 
            {
                FightSpiritConfig._instance = new FightSpiritConfig();
            }
            return FightSpiritConfig._instance;
        }

        /* internal */ /* var */_map: Map<any, any> /* flash.utils.Dictionary */;

        /* internal */ /* var */_mapBreak: Map<any, any> /* flash.utils.Dictionary */;

        public /* var */breakLvArr: Array<any>;

        /* internal */ static /* var */_instance: FightSpiritConfig;
    }
